package cn.tedu.csmall.all.adapter.config;
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;

/**
 * 根据一个或多个
 * 贡献者许可协议授权给 Apache 软件基金会 (ASF)。 有关版权归属的更多信息，请参阅随本作品发布的
 * 有关版权所有权的更多信息。
 * ASF 根据 Apache 许可协议 2.0 版（以下简称 "许可协议"）许可您使用本文件。
 * (许可证"）许可您使用本文件。
 * 除非遵守许可协议，否则不得使用本文件。 您可从以下网址获取许可证副本
 *  *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *  *
 * 除非适用法律要求或书面同意，否则根据本许可协议分发的软件均以 "原样 "为基础分发。
 * 除非适用法律要求或书面同意，否则根据本许可分发的软件均以 "原样 "为基础分发、
 * 无任何明示或暗示的保证或条件。
 * 有关许可协议下的权限和限制的具体语言，请参阅许可协议。
 * 限制的具体语言，请参见许可协议。
 */
@Configuration
@EnableSwagger2WebMvc
public class Knife4jConfiguration {
    @Bean
    public ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .title("csmall-微服务案例-all")
                .description("csmall-微服务案例-all")
                .termsOfServiceUrl("地址待定")
                .contact(new Contact("zhaoyq","zhaoyq@qq.com","zhaoyq@qq.com"))
                .version("1.0")
                .build();
    }

    @Bean
    public Docket createRestApi(ApiInfo apiInfo){
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo)
                .groupName("cart")
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.tedu.csmall.all.adapter.controller"))
                .paths(PathSelectors.any())
                .build();
    }
}
